//
//  UIScrollView+DCRefrashHelper.m
//  Demo
//
//  Created by zhaolin on 2023/2/2.
//

#import "UIScrollView+DCRefrashHelper.h"

@implementation UIScrollView (DCRefrashHelper)
- (void)addNormalHeaderTarget:(id)target action:(SEL)action {
    MJRefreshStateHeader *header = [MJRefreshStateHeader  headerWithRefreshingTarget:target refreshingAction:action];
    [self configureHeader:header];
    self.mj_header = header;
}
- (void)addNormalFooterTarget:(id)target action:(SEL)action{
    MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter  footerWithRefreshingTarget:target refreshingAction:action];
    [self configureFooter:footer];
    self.mj_footer = footer;

}
- (void)configureHeader:(MJRefreshStateHeader *)header {
    header.lastUpdatedTimeLabel.hidden = YES;
//    [header setTitle:@"下拉刷新" forState:MJRefreshStateIdle];
//    [header setTitle:@"释放更新" forState:MJRefreshStatePulling];
//    [header setTitle:@"加载中..." forState:MJRefreshStateRefreshing];
}

- (void)configureFooter:(MJRefreshAutoNormalFooter *)footer {
    footer.automaticallyRefresh = NO;
    //    [footer setTitle:@"上拉加载更多数据" forState:MJRefreshStateIdle];
    //    [footer setTitle:@"松手加载" forState:MJRefreshStatePulling];
    //    [footer setTitle:@"正在拼命加载..." forState:MJRefreshStateRefreshing];
}
@end
